package com.qf.smartdevice.mapper;

import com.qf.smartdevice.pojo.SysScene;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * @author 王博康
 * @version 1.0
 * @project devicemanagementsystem
 * @description: TODO
 * @date 2022/3/22 16:55 星期二
 */
public interface SysSceneMapper {

    @Insert("insert into sys_scene (scene_name,create_by,create_time) values(#{sceneName},#{createBy},#{createTime})")
    int addScene(SysScene sysScene);

    @Select("select * from sys_scene where scene_id=#{sceneId} and scene_name=#{sceneName}")
    SysScene findByIdAndName(SysScene sysScene);

    @Select("select * from sys_scene where scene_id=#{sceneId} ")
    SysScene findById(Long id);

    @Select("select * from sys_scene where create_by=#{userId} and scene_name=#{sceneName}")
    SysScene findByUserAndName(@Param("userId") Long userId,@Param("sceneName") String sceneName);

    @Update("update sys_scene set status=#{status} where scene_id=#{sceneId}")
    int updateScene(@Param("sceneId") Long sceneId,@Param("status") Long  status);
}
